<template>
  <el-popover v-model:visible="visible" placement="bottom" :width="266">
    <p><i class="iconfont ic-tips-fill"></i>{{ title }}</p>
    <div class="btn btn-group">
      <span class="btn-cancel" @click="visible = false">{{ cancelText }}</span>
      <span class="btn-del" @click="submit">{{ submitText }}</span>
    </div>
    <template #reference>
      <span class="del" @click="visible = true">{{ name }}</span>
    </template>
  </el-popover>
</template>

<script lang="ts" setup>
import { ref } from "vue";
const props = defineProps({
  title: {
    type: String,
    default: "",
  },
  cancelText: {
    type: String,
    default: "",
  },
  submitText: {
    type: String,
    default: "",
  },
  name: {
    type: String,
    default: "",
  },
});
const visible = ref(false);
const emits = defineEmits(["success"]);
const submit = () => {
  visible.value = false;
  emits("success");
};
</script>
<style lang="scss" scoped>
i {
  color: #f8344a;
  margin-right: 10px;
}
.del {
  color: #1890ff;
  cursor: pointer;
}
p {
  margin-bottom: 18px;
}
.btn {
  &-group {
    display: flex;
    justify-content: flex-end;
  }
  span {
    width: 48px;
    height: 24px;
    line-height: 24px;
    text-align: center;
    border-radius: 2px;
    font-size: 12px;
    margin-left: 8px;
    cursor: pointer;
  }
  &-cancel {
    background: #f2f3f5;
  }
  &-del {
    background: #f8344a;
    color: #fff;
  }
}
</style>
